//
//  NYPostReplyTableViewCell.m
//  Nooryes
//
//  Created by myPro on 2019/12/31.
//  Copyright © 2019 UUU9. All rights reserved.
//

#import "NYPostReplyTableViewCell.h"
#import "NYCommentListModel.h"

@interface NYPostReplyTableViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *avatar;
@property (weak, nonatomic) IBOutlet UILabel *author;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UILabel *content;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentHeight;

@end


@implementation NYPostReplyTableViewCell


+ (instancetype)cellWithTableView:(UITableView *)tableView{
    NYPostReplyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kNYPostReplyTableViewCell];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
    }
    return cell;
}

-(void)setModel:(CommentListSubModel *)model{
    _model = model;
    [self.avatar sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"head_default"]];
    self.author.text = model.nickname;
    self.time.text = model.writetime;
    [self.contentHeight setConstant:model.contentHeight];
        self.content.text = model.content;
}

//- (IBAction)onComment:(id)sender {
//    _replyingBlock(_model.parent_id);
//}

- (IBAction)onAvatar:(id)sender {
    _avatarBlock(_model.userid);
}

@end
